﻿using System;
using Microsoft.Xna.Framework;
using ProtoBuf;
using System.Collections.Generic;

namespace Network
{
    [Serializable]
    [ProtoContract]
    public class ServerPacket : Packet
    {
        [ProtoMember(1)]
        public List<PlayerInfo> PlayersStates;

        public ServerPacket()
        {
            PlayersStates = new List<PlayerInfo>();
        }

        public ServerPacket(int playersCount)
        {
            PlayersStates = new List<PlayerInfo>(playersCount);
        }
    }
    [Serializable]
    [ProtoContract]
    public class PlayerInfo
    {
        /// <summary>
        /// Id игрока
        /// </summary>
        [ProtoMember(1)]
        public sbyte PlayerId;
        [ProtoMember(2)]
        ProtoPoint ProtoPosition;
        /// <summary>
        /// Позиция игрока
        /// </summary>
        public Vector2 Position
        {
            get
            {
                return new Vector2(ProtoPosition.X, ProtoPosition.Y);
            }
            set { ProtoPosition = new ProtoPoint(value.X, value.Y); }
        }
    }
}
